package com.example.blog2.controller;

import com.example.blog2.model.BlogInfo;
import com.example.blog2.service.BlogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    private BlogService blogService;

    @RequestMapping(value = "/getList",method = RequestMethod.GET)
    List<BlogInfo> getList() {
        log.info("获取博客列表......");
        return blogService.getList();
    }

    @RequestMapping(value = "/getBlogDetail",method = RequestMethod.GET)
    BlogInfo getBlogDetail(Integer blogId) {
        log.info("获取博客详细信息, blogId:{}",blogId);
        return blogService.getBlogDetail(blogId);
    }
}
